/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ro.tni.stripesweb.action;

import java.util.List;
import javax.ejb.EJB;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import ro.tni.stripesweb.Vets;
import ro.tni.stripesweb.VetsFacadeRemote;

/**
 *
 * @author radu
 */
public class VetsActionBean extends BaseActionBean{
   @EJB(mappedName="VetsFacade")
   private VetsFacadeRemote vf;
   
   public String getMessage(){
        return Integer.toString(vf.findAll().size());
    }
    
    public List<Vets> getVets(){
        return vf.findAll();
    }
    
    @DefaultHandler
    public Resolution renderVetsList(){
        return new ForwardResolution("result.jsp");
    }
    
    private Vets vet;

    public Vets getVet() {
        return vet;
    }

    public void setVet(Vets vet) {
        this.vet = vet;
    }
    
    private Integer id;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
        
    public Resolution remove(){
        vet = new Vets();
        vet.setId(id);
        vf.remove(vet);
        return new ForwardResolution("result.jsp");
    }
}
